<?php
require_once("vcl/vcl.inc.php");
require_once("lib/db_connection.php");
date_default_timezone_set('Asia/Manila');
//Includes
use_unit("components4phpfull/jtjavascript.inc.php");
use_unit("components4phpfull/jtsitetheme.inc.php");
use_unit("comctrls.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");

//Class definition
class Queue_Edit extends Page
{
       public $btnUpdate = null;
       public $hfAutoid = null;
       public $imgBack = null;
       public $memoRemarks = null;
       public $cmbProd = null;
       public $Label44 = null;
       public $Label43 = null;
       public $cmbReturnPlantMin = null;
       public $cmbReturnPlantHr = null;
       public $cmbDeptClientMin = null;
       public $cmbDeptClientHr = null;
       public $cmbActLoadingMin = null;
       public $cmbActLoadingHr = null;
       public $cmbArrivalClientMin = null;
       public $cmbArrivalClientHr = null;
       public $cmbEstReturnMin = null;
       public $cmbEstReturnHr = null;
       public $cmbDeptPlantMin = null;
       public $cmbDeptPlantHr = null;
       public $cmbLoadConfMin = null;
       public $cmbLoadConfHr = null;
       public $cmbIssuanceMin = null;
       public $cmbIssuanceHr = null;
       public $Label42 = null;
       public $Label41 = null;
       public $Label40 = null;
       public $Label39 = null;
       public $Label38 = null;
       public $Label37 = null;
       public $Label36 = null;
       public $Label35 = null;
       public $Label34 = null;
       public $cmbArrPlantMin = null;
       public $cmbArrPlantHr = null;
       public $edHname = null;
       public $Label33 = null;
       public $Label32 = null;
       public $Label31 = null;
       public $cmbRtype = null;
       public $Label29 = null;
       public $cmbReason = null;
       public $edHitMiss = null;
       public $Label30 = null;
       public $dpIsuueLoad = null;
       public $Label22 = null;
       public $Label15 = null;
       public $edVolume = null;
       public $Label28 = null;
       public $edLSite = null;
       public $Label27 = null;
       public $JTJavaScript4 = null;
       public $edFname = null;
       public $Label26 = null;
       public $edLname = null;
       public $Label25 = null;
       public $JSRefreshHaulerList = null;
       public $Image4 = null;
       public $JSRefreshDriverList = null;
       public $imgAddDriver = null;
       public $JTJavaScript3 = null;
       public $JTJavaScript2 = null;
       public $JTJavaScript1 = null;
       public $edHtype = null;
       public $cmbHauler = null;
       public $edTruckType = null;
       public $hfHelper = null;
       public $hfInitHelpers = null;
       public $listBoxHelpers = null;
       public $Label23 = null;
       public $btnCancel = null;
       public $dpReturnPlant = null;
       public $dpDepartClient = null;
       public $dpActualUnload = null;
       public $dpArrivalClient = null;
       public $dpEstReturn = null;
       public $dpDepPlant = null;
       public $dpLoadConfirmed = null;
       public $dpArrivalPlant = null;
       public $edCustLoc = null;
       public $edCustno = null;
       public $cmbCustname = null;
       public $edTrip = null;
       public $cmbDriver = null;
       public $cmbPlate = null;
       public $edSO = null;
       public $edQueue = null;
       public $edSequence = null;
       public $edDR = null;
       public $Image3 = null;
       public $Label21 = null;
       public $Label20 = null;
       public $Label19 = null;
       public $Label18 = null;
       public $JTSiteTheme1 = null;
       public $Label17 = null;
       public $Label16 = null;
       public $Label14 = null;
       public $Label13 = null;
       public $Label12 = null;
       public $Label11 = null;
       public $Label10 = null;
       public $Image1 = null;
       public $Label9 = null;
       public $Label8 = null;
       public $Label7 = null;
       public $Label6 = null;
       public $Label5 = null;
       public $Label4 = null;
       public $Label3 = null;
       public $Label2 = null;
       public $Label1 = null;
       public $Image2 = null;
       public $lblengine = null;
       function imgBackClick($sender, $params)
       {
       redirect('queue_list.php');


       }

       function imgBackJSMouseOut($sender, $params)
       {

       ?>
       //Add your javascript code here
       document.images['imgBack'].src="image/btn_back.png"
       <?php

       }

       function imgBackJSMouseOver($sender, $params)
       {

       ?>
       //Add your javascript code here
       document.images['imgBack'].src="image/btn_back2.png"
       <?php

       }

       function btnCancelClick($sender, $params)
       {
       redirect('queue_list.php');


       }

       function cmbDriverJSChange($sender, $params)
       {

       ?>
       //Add your javascript code here
       loadDriver();
       return false;
       <?php

       }

       function Image4JSClick($sender, $params)
       {

       ?>
       var win_height = 650;
       var win_width = 875;
       var height = window.outerHeight;
       var width = window.outerWidth;
       var top = Math.round((height-win_height)/2);
       var left = Math.round((width-win_width)/2);

       window.open("hauler_create_otf.php", 'Create_Hauler', 'location=no,height='+win_height+',width='+win_width+',top='+top+',left='+left);
       <?php

       }

       function imgAddDriverJSClick($sender, $params)
       {

       ?>
       var win_height = 650;
       var win_width = 675;
       var height = window.outerHeight;
       var width = window.outerWidth;
       var top = Math.round((height-win_height)/2);
       var left = Math.round((width-win_width)/2);

       window.open("personnel_create_otf.php", 'Create_Personnel', 'location=no,height='+win_height+',width='+win_width+',top='+top+',left='+left);
       <?php

       }

       function cmbCustnameJSChange($sender, $params)
       {

       ?>
       //Add your javascript code here
       loadCust();
       return false;
       <?php

       }

       function cmbHaulerJSChange($sender, $params)
       {

       ?>
       //Add your javascript code here
       loadHauler();
       return false;
       <?php

       }

       function btnUpdateClick($sender, $params)
       {

       //Vehicle
       $veh_id = $this->cmbPlate->getItemIndex();
       $query_veh = "SELECT * FROM vehicle_tbl WHERE company_id='".$_SESSION['company_id']."' and vehicle_id='".$veh_id."'";
       $result_veh = mysql_query($query_veh) or die("SELECT VEH ".mysql_error());
       $row_veh = mysql_fetch_array($result_veh);

       //Driver
       $emp_id = $this->cmbDriver->getItemIndex();
       $query_driver = "SELECT * FROM employee_tbl WHERE job_title='Driver' AND company_id='".$_SESSION['company_id']."' and autoid='".$emp_id."'";
       $result_driver = mysql_query($query_driver) or die("SELECT DRIVER ".mysql_error());
       $row_emp = mysql_fetch_array($result_driver);

       //Hauler
       $hauler_id = $this->cmbHauler->getItemIndex();
       $query_hauler = "SELECT * FROM hauler_tbl WHERE company_id='".$_SESSION['company_id']."' and hauler_id='".$hauler_id."'";
       $result_hauler = mysql_query($query_hauler) or die("SELECT HAULER ".mysql_error());
       $row_hauler = mysql_fetch_array($result_hauler);

       //Customer
       $cust_id = $this->cmbCustname->getItemIndex();
       $query_cust = "SELECT * FROM vendor_tbl WHERE company_id='".$_SESSION['company_id']."' and vendor_id='".$cust_id."'";
       $result_cust = mysql_query($query_cust) or die("SELECT CUST ".mysql_error());
       $row_cust = mysql_fetch_array($result_cust);

       //time
       $arr_plant_time = $this->cmbArrPlantHr->getItemIndex().":".$this->cmbArrPlantMin->getItemIndex();
       $issuance_time = $this->cmbIssuanceHr->getItemIndex().":".$this->cmbIssuanceMin->getItemIndex();
       $load_conf_time = $this->cmbLoadConfHr->getItemIndex().":".$this->cmbLoadConfMin->getItemIndex();
       $dept_plant_time = $this->cmbDeptPlantHr->getItemIndex().":".$this->cmbDeptPlantMin->getItemIndex();
       $est_return_time = $this->cmbEstReturnHr->getItemIndex().":".$this->cmbEstReturnMin->getItemIndex();

       $arr_client_time = $this->cmbArrivalClientHr->getItemIndex().":".$this->cmbArrivalClientMin->getItemIndex();
       $act_load_time = $this->cmbActLoadingHr->getItemIndex().":".$this->cmbActLoadingMin->getItemIndex();
       $dept_client_time = $this->cmbDeptClientHr->getItemIndex().":".$this->cmbDeptClientMin->getItemIndex();
       $return_plant_time = $this->cmbReturnPlantHr->getItemIndex().":".$this->cmbReturnPlantMin->getItemIndex();

       //$curr_timestamp = date("Y-m-d H:i:s");
       $query_update = "UPDATE queue_tbl SET
       dr_no='".$this->edDR->Text."',
       sequence_no='".$this->edSequence->Text."',
       plate_no='".$row_veh['veh_num']."',
       plate_id='".$this->cmbPlate->getItemIndex()."',
       trip_no='".$this->edTrip->Text."',
       driver_code='".$row_emp['emp_id']."',
       driver_name='".$row_emp['lname'].','.$row_emp['fname']."',
       driver_id='".$this->cmbDriver->getItemIndex()."',
       truck_type='".$this->edTruckType->Text."',
       hauler_code='".$row_hauler['hauler_code']."',
       hauler_name='".$row_hauler['hauler_name']."',
       hauler_id='".$this->cmbHauler->getItemIndex()."',
       hauler_type='".$this->edHtype->Text."',
       cust_name='".$row_cust['vendor_name']."',
       cust_id='".$this->cmbCustname->getItemIndex()."',
       cust_no='".$this->edCustno->Text."',
       cust_loc='".$this->edCustLoc->Text."',
       cust_vol='".$this->edVolume->Text."',
       cust_prod='".$this->cmbProd->getItemIndex()."',
       loading_site='".$this->edLSite->Text."',
       hit_miss='".$this->edHitMiss->Text."',
       reason='".$this->cmbReason->getItemIndex()."',
       reason_type='".$this->cmbRtype->getItemIndex()."',
       arrival_at_plant='".$this->dpArrivalPlant->Text."',
       issue_loading_note='".$this->dpIsuueLoad->Text."',
       load_confirmed='".$this->dpLoadConfirmed->Text."',
       dept_on_plant='".$this->dpDepPlant->Text."',
       est_return='".$this->dpEstReturn->Text."',
       arrival_at_client='".$this->dpArrivalClient->Text."',
       actual_unloading='".$this->dpActualUnload->Text."',
       departure_at_client='".$this->dpDepartClient->Text."',
       return_to_plant='".$this->dpReturnPlant->Text."',
       arrival_at_plant_time='".$arr_plant_time."',
       issue_loading_note_time='".$issuance_time."',
       load_confirmed_time='".$load_conf_time."',
       dept_on_plant_time='".$dept_plant_time."',
       est_return_time='".$est_return_time."',
       arrival_at_client_time='".$arr_client_time."',
       actual_unloading_time='".$act_load_time."',
       departure_at_client_time='".$dept_client_time."',
       return_to_plant_time='".$return_plant_time."',
       helpers_id='".$this->hfHelper->getValue()."',
       remarks='".$this->memoRemarks->Text."'
       WHERE autoid='".$this->hfAutoid->getValue()."'";
       mysql_query($query_update) or die(mysql_error());


       echo"<script language=javascript>
       alert('Successfully updated record!');
       //parent.document.getElementById('flag').value = 'imgStatus';
       //parent.document.images['imgStatus'].src='image/status3.png'
       //parent.clear('imgStatus');
       parent.document.getElementById('JTFrameMain').src = 'queue_list.php';
       var win_height = 600;
       var win_width = 810;
       var height = window.outerHeight;
       var width = window.outerWidth;
       var top = Math.round((height-win_height)/2);
       var left = Math.round((width-win_width)/2);
       //window.open('print_queue_slip.php?queue_id=".$this->hfAutoid->getValue()."', 'print_inline', 'location=no,height='+win_height+',width='+win_width+',top='+top+',left='+left);
       </script>";

       //redirect('queue_list.php');
       }


       function cmbPlateJSChange($sender, $params)
       {

       ?>
       //Add your javascript code here
       loadXMLDoc();
       return false;
       <?php

       }


       function clear()
       {
       $this->edDR->Text='';
       $this->edSequence->Text='';
       $this->edQueue->Text='';
       $this->edSO->Text='';
       $this->edTrip->Text='';
       $this->edTruckType->Text='';
       $this->edHtype->Text='';
       $this->edCustno->Text='';
       $this->edCustLoc->Text='';
       $this->dpArrivalPlant->Text='';
       $this->dpLoadConfirmed->Text='';
       $this->dpDepPlant->Text='';
       $this->dpEstReturn->Text='';
       $this->dpArrivalClient->Text='';
       $this->dpActualUnload->Text='';
       $this->dpDepartClient->Text='';
       $this->dpReturnPlant->Text='';
       $this->edLSite->Text='';
       $this->edVolume->Text='';
       $this->edHitMiss->Text='';
       $this->memoRemarks->Lines=array();
       }


       function Queue_EditCreate($sender, $params)
       {
       $autoid = $_GET['autoid'];
       if($autoid!='')
       $this->hfAutoid->setValue(base64_decode($autoid));

       $query_sel = "SELECT * FROM queue_tbl WHERE autoid='".$this->hfAutoid->getValue()."'";
       $result_sel = mysql_query($query_sel) or die("SELECT QUEUE ".mysql_error());
       $row_sel = mysql_fetch_array($result_sel);

       $dr_id = $row_sel['driver_id'];
       $query_emp = "SELECT * FROM employee_tbl WHERE autoid='".$dr_id."'";
       $result_emp = mysql_query($query_emp) or die("SELECT EMP ".mysql_error());
       $row_emp = mysql_fetch_array($result_emp);

       $helpers_id = explode(',',$row_sel['helpers_id']);
       $this->listBoxHelpers->Clear();
       foreach($helpers_id as $hid)
       {
        $query_helper = "SELECT lname, fname FROM employee_tbl WHERE autoid='".$hid."'";
        $result_helper = mysql_query($query_helper) or die("SELECT HELPER ".mysql_error());
        $row_helper = mysql_fetch_array($result_helper);
        $this->listBoxHelpers->AddItem($row_helper['lname'].", ".$row_helper['fname'],'',$row_helper['lname'].", ".$row_helper['fname']);
       }

       $this->hfInitHelpers->setValue($row_sel['helpers_id']);
       if($autoid!='')
       {
       $this->hfHelper->setValue($row_sel['helpers_id']);
       }

       $this->edTrip->Text = $row_sel['trip_no'];
       $this->edDR->Text = $row_sel['dr_no'];
       //$this->edPlate->Text = $row_sel['plate_no'];

       //$this->edDrcode->Text = $row_sel['driver_code'];
       $this->edLname->Text = $row_emp['lname'];
       $this->edFname->Text = $row_emp['fname'];

       //$this->edHcode->Text = $row_sel['hauler_code'];
       $this->edHname->Text = $row_sel['hauler_name'];

       $this->edTruckType->Text = $row_sel['truck_type'];
       $this->edLSite->Text = $row_sel['loading_site'];

       //$this->edCustname->Text = $row_sel['cust_name'];
       $this->edCustno->Text = $row_sel['cust_no'];
       $this->edCustLoc->Text = $row_sel['cust_loc'];
       $this->edVolume->Text = $row_sel['cust_vol'];
       $this->edCustLoc->Text = $row_sel['cust_loc'];
       $this->cmbProd->ItemIndex = $row_sel['cust_prod'];

       $this->dpArrivalPlant->Text = $row_sel['arrival_at_plant'];
       $this->dpIsuueLoad->Text = $row_sel['issue_loading_note'];
       $this->dpLoadConfirmed->Text = $row_sel['load_confirmed'];
       $this->dpDepPlant->Text = $row_sel['dept_on_plant'];
       $this->dpEstReturn->Text = $row_sel['est_return'];

       $ArrPlant = explode(":",$row_sel['arrival_at_plant_time']);
       $this->cmbArrPlantHr->ItemIndex = $ArrPlant[0];
       $this->cmbArrPlantMin->ItemIndex = $ArrPlant[1];

       $Issuance = explode(":",$row_sel['issue_loading_note_time']);
       $this->cmbIssuanceHr->ItemIndex = $Issuance[0];
       $this->cmbIssuanceMin->ItemIndex = $Issuance[1];

       $LoadTime = explode(":",$row_sel['load_confirmed_time']);
       $this->cmbLoadConfHr->ItemIndex = $LoadTime[0];
       $this->cmbLoadConfMin->ItemIndex = $LoadTime[1];

       $DepPlant = explode(":",$row_sel['dept_on_plant_time']);
       $this->cmbDeptPlantHr->ItemIndex = $DepPlant[0];
       $this->cmbDeptPlantMin->ItemIndex = $DepPlant[1];

       $EstReturn = explode(":",$row_sel['est_return_time']);
       $this->cmbEstReturnHr->ItemIndex = $EstReturn[0];
       $this->cmbEstReturnMin->ItemIndex = $EstReturn[1];

       $this->dpArrivalClient->Text = $row_sel['arrival_at_client'];
       $this->dpActualUnload->Text = $row_sel['actual_unloading'];
       $this->dpDepartClient->Text = $row_sel['departure_at_client'];
       $this->dpReturnPlant->Text = $row_sel['return_to_plant'];

       $ArrClient = explode(":",$row_sel['arrival_at_client_time']);
       $this->cmbArrivalClientHr->ItemIndex = $ArrClient[0];
       $this->cmbArrivalClientMin->ItemIndex = $ArrClient[1];

       $ActualUnload = explode(":",$row_sel['actual_unloading_time']);
       $this->cmbActLoadingHr->ItemIndex = $ActualUnload[0];
       $this->cmbActLoadingMin->ItemIndex = $ActualUnload[1];

       $DepClient = explode(":",$row_sel['departure_at_client_time']);
       $this->cmbDeptClientHr->ItemIndex = $DepClient[0];
       $this->cmbDeptClientMin->ItemIndex = $DepClient[1];

       $ReturnPlant = explode(":",$row_sel['return_to_plant_time']);
       $this->cmbReturnPlantHr->ItemIndex = $ReturnPlant[0];
       $this->cmbReturnPlantMin->ItemIndex = $ReturnPlant[1];

       $this->memoRemarks->Text = $row_sel['remarks'];
       $this->edHitMiss->Text = $row_sel['hit_miss'];
       $this->cmbReason->ItemIndex = $row_sel['reason'];
       $this->cmbRtype->ItemIndex = $row_sel['reason_type'];



       //Driver drop-down
       $query_driver = "SELECT * FROM employee_tbl WHERE job_title='Driver' AND company_id='".$_SESSION['company_id']."'";
       $result_driver = mysql_query($query_driver) or die("SELECT DRIVER ".mysql_error());
       $this->cmbDriver->Clear();
       $this->cmbDriver->ItemIndex = $row_sel['driver_code'];
       while($row_driver = mysql_fetch_array($result_driver))
       {
        $this->cmbDriver->AddItem($row_driver['emp_id'],null,$row_driver['autoid']);
       }


       //Vehicle drop-down
       $query_veh = "SELECT * FROM dts_veh_tbl WHERE company_id='".$_SESSION['company_id']."'";
       $result_veh = mysql_query($query_veh) or die("SELECT VEH ".mysql_error());
       //die($query_veh);
       $this->cmbPlate->Clear();
       $this->cmbPlate->AddItem($row_sel['plate_no'],null,$row_sel['plate_id']);
       while($row_veh = mysql_fetch_array($result_veh))
       {
        $ctr_clear = 0;
        $query_check_queue = "SELECT status FROM queue_tbl WHERE plate_id='".$row_veh['vehicle_id']."'";
        $result_check_queue = mysql_query($query_check_queue) or die("SELECT CHECK QUEUE ".mysql_error());
        while($row_check_queue = mysql_fetch_array($result_check_queue))
        {
         if($row_check_queue['status']!='Complete')
         $ctr_clear++;
        }
        if($ctr_clear==0)
        $this->cmbPlate->AddItem($row_veh['veh_num'],null,$row_veh['vehicle_id']);
       }
       $this->cmbPlate->ItemIndex = $row_sel['plate_no'];


       //Hauler drop-down
       $query_hauler = "SELECT * FROM hauler_tbl WHERE company_id='".$_SESSION['company_id']."'";
       $result_hauler = mysql_query($query_hauler) or die("SELECT HAULER ".mysql_error());
       //die($query_veh);
       $this->cmbHauler->Clear();
       $this->cmbHauler->ItemIndex = $row_sel['hauler_code'];
       while($row_hauler = mysql_fetch_array($result_hauler))
       {
        $this->cmbHauler->AddItem($row_hauler['hauler_code'],null,$row_hauler['hauler_id']);
       }


       //Customer drop-down
       $query_vendor = "SELECT * FROM vendor_tbl WHERE company_id='".$_SESSION['company_id']."' and isCustomer='1'";
       $result_vendor = mysql_query($query_vendor) or die("SELECT VENDOR ".mysql_error());
       //die($query_veh);
       $this->cmbCustname->Clear();
       $this->cmbCustname->ItemIndex = $row_sel['cust_name'];
       while($row_vendor = mysql_fetch_array($result_vendor))
       {
        $this->cmbCustname->AddItem($row_vendor['vendor_name'],null,$row_vendor['vendor_id']);
       }

       //Hr/Min Est Arrival Plant drop-down
       $count = 0;
       while($count<=23)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $hr = '0'.$count;
       }
       else
       {
       $hr = $count;
       }
       $this->cmbArrPlantHr->AddItem($hr,'',$hr);
       $count++;
       }

       $count = 0;
       while($count<=59)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $min = '0'.$count;
       }
       else
       {
       $min = $count;
       }
       $this->cmbArrPlantMin->AddItem($min,'',$min);
       $count++;
       }


       //Hr/Min Issuance of loading drop-down
       $count = 0;
       while($count<=23)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $hr = '0'.$count;
       }
       else
       {
       $hr = $count;
       }
       $this->cmbIssuanceHr->AddItem($hr,'',$hr);
       $count++;
       }

       $count = 0;
       while($count<=59)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $min = '0'.$count;
       }
       else
       {
       $min = $count;
       }
       $this->cmbIssuanceMin->AddItem($min,'',$min);
       $count++;
       }



       //Hr/Min Load Confirmed drop-down
       $count = 0;
       while($count<=23)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $hr = '0'.$count;
       }
       else
       {
       $hr = $count;
       }
       $this->cmbLoadConfHr->AddItem($hr,'',$hr);
       $count++;
       }

       $count = 0;
       while($count<=59)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $min = '0'.$count;
       }
       else
       {
       $min = $count;
       }
       $this->cmbLoadConfMin->AddItem($min,'',$min);
       $count++;
       }


       //Hr/Min Dept Plant drop-down
       $count = 0;
       while($count<=23)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $hr = '0'.$count;
       }
       else
       {
       $hr = $count;
       }
       $this->cmbDeptPlantHr->AddItem($hr,'',$hr);
       $count++;
       }

       $count = 0;
       while($count<=59)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $min = '0'.$count;
       }
       else
       {
       $min = $count;
       }
       $this->cmbDeptPlantMin->AddItem($min,'',$min);
       $count++;
       }


       //Hr/Min Est Return drop-down
       $count = 0;
       while($count<=23)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $hr = '0'.$count;
       }
       else
       {
       $hr = $count;
       }
       $this->cmbEstReturnHr->AddItem($hr,'',$hr);
       $count++;
       }

       $count = 0;
       while($count<=59)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $min = '0'.$count;
       }
       else
       {
       $min = $count;
       }
       $this->cmbEstReturnMin->AddItem($min,'',$min);
       $count++;
       }


       //Hr/Min Arrival Client drop-down
       $count = 0;
       while($count<=23)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $hr = '0'.$count;
       }
       else
       {
       $hr = $count;
       }
       $this->cmbArrivalClientHr->AddItem($hr,'',$hr);
       $count++;
       }

       $count = 0;
       while($count<=59)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $min = '0'.$count;
       }
       else
       {
       $min = $count;
       }
       $this->cmbArrivalClientMin->AddItem($min,'',$min);
       $count++;
       }


       //Hr/Min Actual loading drop-down
       $count = 0;
       while($count<=23)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $hr = '0'.$count;
       }
       else
       {
       $hr = $count;
       }
       $this->cmbActLoadingHr->AddItem($hr,'',$hr);
       $count++;
       }

       $count = 0;
       while($count<=59)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $min = '0'.$count;
       }
       else
       {
       $min = $count;
       }
       $this->cmbActLoadingMin->AddItem($min,'',$min);
       $count++;
       }


       //Hr/Min Departure on client drop-down
       $count = 0;
       while($count<=23)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $hr = '0'.$count;
       }
       else
       {
       $hr = $count;
       }
       $this->cmbDeptClientHr->AddItem($hr,'',$hr);
       $count++;
       }

       $count = 0;
       while($count<=59)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $min = '0'.$count;
       }
       else
       {
       $min = $count;
       }
       $this->cmbDeptClientMin->AddItem($min,'',$min);
       $count++;
       }


       //Hr/Min Return Plant drop-down
       $count = 0;
       while($count<=23)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $hr = '0'.$count;
       }
       else
       {
       $hr = $count;
       }
       $this->cmbReturnPlantHr->AddItem($hr,'',$hr);
       $count++;
       }

       $count = 0;
       while($count<=59)
       {
       $exp_count = strlen($count);
       if($exp_count==1)
       {
       $min = '0'.$count;
       }
       else
       {
       $min = $count;
       }
       $this->cmbReturnPlantMin->AddItem($min,'',$min);
       $count++;
       }


       }



       function listBoxHelpersJSClick($sender, $params)
       {

       ?>
       var win_height = 550;
       var win_width = 610;
       var height = window.outerHeight;
       var width = window.outerWidth;
       var top = Math.round((height-win_height)/2);
       var left = Math.round((width-win_width)/2);

       hids = document.getElementById("hfInitHelpers").value;
       window.open("select_helper.php?hids="+hids, 'Select_Trouble', 'location=no,height='+win_height+',width='+win_width+',top='+top+',left='+left);
       <?php

       }

}

global $application;

global $Queue_Edit;

//Creates the form
$Queue_Edit=new Queue_Edit($application);

//Read from resource file
$Queue_Edit->loadResource(__FILE__);

//Shows the form
$Queue_Edit->show();

?>